<!--<h2 class="contentTitle">表单验证</h2>-->


<div class="pageContent">
	
	{if $action_name=='add'}
		{if $type=='cat'}
			<form id="myform" method="post" action="{:U('Attribute/editcatattr')}" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">
		{else}
			<form id="myform" method="post" action="{:U($module_name.'/insert')}" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">
		{/if}
	{else}
		<form id="myform" method="post" action="{:U($module_name.'/update')}" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">
		{if $info['id']}
			<input type="hidden" name="id" value="{$info['id']}" />
		{/if}

	{/if}
		<div class="pageFormContent nowrap" layoutH="97">
			{if $type=='cat'}
			<dl>
				<dt>分类组：</dt>
				<dd><select name="category_id">
                    <option value="">请选择分类</option>
                    <option value="3">手机</option>
                    <option value="70">平板电脑</option>
                    <option value="4">手机配件</option>
                    <option value="14">手机饰品</option>
                    <option value="186">手机靓号</option>					
					</select>
				</dd>
			</dl>
			{/if}
			<dl>
				<dt>属性名称：</dt>
				<dd>
					<input type="text" name="name" maxlength="20" class="required"  
					 placeholder="请输入属性名称" value="{$info['name']}" style="float: none;" data-validate="validate(required);"/>
				</dd>
			</dl>
				<dl>
				<dt>属性别名：</dt>
				<dd>
					<input type="text" name="alias" maxlength="20" class="required"  
					 placeholder="请输入分组别名" value="{$info['alias']}" style="float: none;" data-validate="validate(required);"/>
				</dd>
			</dl>
			<dl>
				<dt>属性值：</dt>
				<dd>
					<input type="text" name="value" maxlength="20" class="required"  
					 placeholder="请输入属性值" value="{$info['value']}" style="float: none;" data-validate="validate(required);"/>
				</dd>
			</dl>
			<dl>
				<dt>排序：</dt>
				<dd>
					<input type="text" name="sequence"  class="digits required"   
					 placeholder="只能输入自然数" value="{$info['sequence']}" style="float: none;" data-validate="validate(required,digits);"/>
				</dd>
			</dl>
			<dl>
				<dt>状态：</dt>
				<dd>
					<select name="status" class="required">
						<option value="1" {if $info['status']&&$key==$info['status']}selected='selected'{/if}>支持搜索</option>						
						<option value="0" {if $info['status']&&$key==$info['status']}selected='selected'{/if}>不支持搜索</option>						
					</select>
				</dd>
			</dl>
		</div>
			<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>		
	</form>
	
</div>

<script>
    $(function(){
        $.ketchup.createErrorContainer(function(form, el) {
            return $('<ul/>', {
                    'class': 'ketchup-custom'
                    }).insertAfter(el);
        }).addErrorMessages(function(form, el, container, messages) {
            container.html('');

            for(i = 0; i < messages.length; i++) {
            $('<li/>', {
                text: messages[i]
            }).appendTo(container);
            }
        }).showErrorContainer(function(form, el, container) {
            container.slideDown('fast');
        }).hideErrorContainer(function(form, el, container) {
            container.slideUp('fast');
        });

        $('#myform').ketchup({
            validateEvents: 'blur keyup'
        });    
    })
</script>